package com.zzh.myapplication.view;

import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;

import java.util.List;

public abstract class AbsHeaderView<T> {

    protected Activity mActivity;
    protected LayoutInflater mInflate;
    protected T mEntity;

    public AbsHeaderView(Activity activity) {
        this.mActivity = activity;
        mInflate = LayoutInflater.from(activity);
    }

    public View fillView(T t) {
        if (t == null) {
            return null;
        }
        if ((t instanceof List) && ((List) t).size() == 0) {
            return null;
        }
        this.mEntity = t;
        return getView(t);
    }

    protected abstract View getView(T t);

}
